#ifndef _Screen_H_
#define _Screen_H_

#include <iostream>
#include <string>
using namespace std;
class Screen{
	public:
		typedef string::size_type pos;
		Screen()=default;
		Screen(pos wd,pos ht,char c):width(wd),height(ht),content(wd*ht,c)
		{
			for(int i=1;i<=ht;++i)
				content.insert(wd*i+i-1,1,'\n');
		}
		char get() const{return content[cursor];}
		inline char get(pos ht,pos wd)const;
		Screen &set(char);
		Screen &set(pos,pos,char);
		Screen &move(pos r,pos c);
		Screen &display(ostream &os){do_display(os);return *this;}
		inline int get_width() const{return width;}
		inline int get_height() const{return height;}
		inline string &get_content() {return this->content;}
		
	private:
		pos cursor=0;
		pos width=0;
		pos height=0;
		string content;
		void do_display(std::ostream &os)
		{
			for(auto it=content.begin();it!=content.end();++it)
				os<<(*it);					
		}
};
#endif